package com.anche.cywebnew.Utils.netsdk.callback;

import com.sun.jna.Pointer;

import static com.anche.cywebnew.Utils.netsdk.NetSDKLib.*;
import static com.anche.cywebnew.Utils.netsdk.product.DahRecorder.netsdk;

public class DownLoadPosCallBackByTime implements fTimeDownLoadPosCallBack {

    private String msg = "";

    private LLong m_hDownLoadHandle;

    @Override
    public void invoke(LLong lPlayHandle, int dwTotalSize, int dwDownLoadSize, int index, NET_RECORDFILE_INFO.ByValue recordfileinfo, Pointer dwUser) {
        //System.out.println("ByTime " + dwDownLoadSize + " / " + dwTotalSize);
        if (dwDownLoadSize == -1) {
            if (netsdk.CLIENT_StopDownload(m_hDownLoadHandle)) {
                msg = "停止下载成功";
            } else {
                msg = "停止下载失败" + netsdk.CLIENT_GetLastError();
            }
        }
    }

    public String getMsg() {
        return msg;
    }

    public void setM_hDownLoadHandle(LLong m_hDownLoadHandle) {
        this.m_hDownLoadHandle = m_hDownLoadHandle;
    }
}
